﻿<%@ Page Title="Edit Ad" Language="C#" MasterPageFile="~/Classified/Cld-Menu.master" AutoEventWireup="true" CodeFile="Cld-Edit-Ad.aspx.cs" Inherits="Classified_Cld_Edit_Ad" %>
 <%@ Register Src="~/UserControls/User-Login.ascx" TagName="Login" TagPrefix="control" %>
<%@ Register Src="~/Classified/UserControls/Cld-SearchControl.ascx" TagName="Search" TagPrefix="control" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headSubMaster" Runat="Server">
  
    <script type="text/javascript">
        function DeleteImage(ctrl,AdImageVideoID,AdID) {
            var text = { "AdImageVideoID": AdImageVideoID, 'AdID': AdID };
            $.ajax({
                type: "POST",
                url: "/WebServices/DataService.asmx/Deactivate_AdImageVideos",
                data: JSON.stringify(text),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                if(msg.d.length >0)
                alert(msg.d);
                else
                    $(ctrl).parent().parent().remove();
                }
            });
        }
        function UnAuthorized() {
            alert('You are not authorized to edit this ad!!!');
            window.parent.location='/Classified/Cld-Home.aspx';
        }


        function reload() {
            var adid = document.getElementById('<%#hdnAdID.ClientID %>')
            window.parent.location = '/Classified/Cld-Edit-Ad.aspx?AdID=' + adid.value;
        }
	</script>
 <script type="text/javascript">
     var upload_number = 0;
     var vid = 0;

 

     function GetDynamicFileUpload() {
         return ' <div class="registerion_row registerion_row_none"><div class="registerion_row_left">Upload Image</div>' +
        '<div class="registerion_row_right"><input name = "ImageFileUpload"  type="file"  onchange="return checkFileExtension(this);"/>' +
        '  <input class="remove" type="button" value="Remove" onclick = "RemoveFileUpload(this)" /> </div></div>'
     }
     function AddFileUpload() {

         var ImageLimit = 4;
         var oldimage = eval('<%=CurrentUploadImages %>')
         if (upload_number + oldimage < ImageLimit) {
             var div = document.createElement('DIV');
             div.innerHTML = GetDynamicFileUpload("");
             document.getElementById("divFileUpload").appendChild(div);
             upload_number++;
         }
         else {
             alert("Sorry you can not upload more than " + ImageLimit);
         }
     }

     function RemoveFileUpload(div) {
         document.getElementById("divFileUpload").removeChild(div.parentNode.parentNode.parentNode);
         upload_number--;
     }

 </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_SubMaster" Runat="Server">
<asp:HiddenField ID="hdnAdID" runat="server" />
      <div class="clear"></div>
<section>
<div class="left_column">
    <div class="product_row_large">
          <h1>Ad Details</h1>
          <div class="pl10px">
         
              <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
              <ContentTemplate>
         
         <div class="registerion_row registerion_row_none">
              <div class="registerion_row_left">Category<span class="redstar">*</span></div>
              <div class="registerion_row_right">
                  <asp:DropDownList ID="ddlCategory" CssClass="droupdownlist dropdownarrowstyle"  AutoPostBack="true"
                      Width="357" runat="server" 
                      onselectedindexchanged="ddlCategory_SelectedIndexChanged">
                  </asp:DropDownList>
                <div class="listbox_icon_profile"></div> 
         	  </div>
         </div>
         <div class="registerion_row registerion_row_none">
              <div class="registerion_row_left">Sub Category<span class="redstar">*</span></div>
              <div class="registerion_row_right">
                  <asp:DropDownList ID="ddlSubCategory" CssClass="droupdownlist dropdownarrowstyle" Width="357" runat="server" AppendDataBoundItems="true">
                  <asp:ListItem Text="Select" Value="0"></asp:ListItem>
                  </asp:DropDownList>
                <div class="listbox_icon_profile"></div> 
         	  </div>
         </div>

         </ContentTemplate></asp:UpdatePanel>
         <div class="registerion_row registerion_row_none">
              <div class="registerion_row_left">Ad Title <span class="redstar">*</span></div>
              <div class="registerion_row_right">
                <ul>
                   <li><asp:TextBox ID="txtTitle" CssClass="input115px input345px" runat="server"></asp:TextBox></li>
                </ul>
         	  </div>
         </div>     
         <asp:FileUpload ID="df" runat="server" class="hide" />
  <asp:UpdatePanel id="sdf" runat="server"><ContentTemplate>
         <div id="divFiles" runat="server"></div>
  </ContentTemplate></asp:UpdatePanel>

 <div class="registerion_row registerion_row_none">
              <div class="registerion_row_left">Upload Image <span class="redstar"></span></div>
              <div class="registerion_row_right">
                  <input class="add" type="button" value="Add More" onclick = "AddFileUpload()"  />
         	  </div>
         </div>
         <div id="divFileUpload"></div>
     

         <div class="registerion_row registerion_row_none">
              <div class="registerion_row_left">State<span class="redstar">*</span></div>
              <div class="registerion_row_right">
                <asp:TextBox ID="txtState" CssClass="input115px input345px" runat="server"></asp:TextBox>
         	  </div>
         </div>

     <div class="registerion_row registerion_row_none">
              <div class="registerion_row_left">Land Mark<span class="redstar">*</span></div>
              <div class="registerion_row_right">
                <asp:TextBox ID="txtLandMark" CssClass="input115px input345px" runat="server"></asp:TextBox>
         	  </div>
         </div>

         
   
         <div class="registerion_row registerion_row_none">
              <div class="registerion_row_left">Description <span class="redstar">*</span></div>
              <div class="registerion_row_right">
              
                <asp:TextBox ID="txtDescription" CssClass="input115px input345px" runat="server" 
                      Height="188px" TextMode="MultiLine" Width="474px"></asp:TextBox>
         	  </div>
         </div>
         
             <asp:ImageButton ID="ImageButton1" ImageUrl="~/Classified/images/update.jpg" class="mt20px submitbutton" 
                   runat="server"  onclick="ImageButton1_Click"  />
    &nbsp;&nbsp;<asp:Label ID="lblMsg" runat="server" CssClass="password paddingbot" Font-Bold="true" ForeColor="Red" EnableViewState="false"></asp:Label>
       
      </div>
      <div class="clear"></div>
        </div>
   
      </div>
      <div class="right_column">
    <control:Login ID="Login1" runat="server" />
     
     <control:Search ID="Login2" runat="server" />
    


    <div class="clear"></div>
   
  </div>
      <div class="clear"></div>
      </section>
</asp:Content>